<!--
 * Copyright ©
 * #  
 * @author: zw
 * @date: 2021-11-09 
 -->


<template>
  <div class="pb-12">
    <cons-card :name="week.name" :allIndex="week.all"></cons-card>
    <ConList :data="week"></ConList>
  </div>
</template>

<script lang="js">
import { defineComponent, onMounted, ref, onActivated, computed } from "vue";
import { useStore } from "vuex";
import ConList from "@/components/List/Week.vue";
import getData from "@/services";
export default defineComponent({
  name: "~Week",
  components: { ConList },
  setup(props, { emit, slots }) {
    const store = useStore(),
    state = store.state,
    status = ref('');
    onMounted(() => {
      getData(store);
      status.value = state.consName;
    });
    onActivated(() => {
      if (status.value !== state.consName) {
        getData(store);
        status.value = state.consName;
      }
    });

    return {
      week: computed(() => state.week)
    };
  },
});
</script>

<style lang="css" scoped></style>